var mongoose = require('mongoose');

const login = async function (parameter) {
    return await mongoose.model("admin").findOne(parameter)
}

const get = async ()=>await mongoose.model("admin").find()


const create = async (data) => await mongoose.model("admin").create(data);

const getById = async (_id)=>await mongoose.model('admin')

//删除指定
const deleted = async (_id)=> await mongoose.model('admin').deleteOne({ _id });


//更新指定
const update = async (_id, parameter)=> await mongoose.model('admin').updateOne({ _id }, parameter);

//搜索
const search = async (params)=>await mongoose.model("admin").find(params)

module.exports = {login,get,create,getById,update,deleted,search}